/**
 * Created by Administrator on 2019/5/20 0020.
 */
/**
 *添加月球
 * @param id 月球id
 * @param OrbitStartTime 建立场景时间
 * @param OrbitEndTime 场景结束时间
 * @param position 月球轨道数据 J2000 [t(s),x(m),y(m),z(m),t(s),x(m),y(m),z(m)]
 */
import CZML_GENERALTOOLS_CLASS from "../main/CZML_GENERALTOOLS_CLASS.js"
class CZML_Moon {
    constructor(viewer, id, OrbitStartTime, OrbitEndTime, position, imagePath) {
        this._viewer = viewer
        this.id = id
        this.OrbitStartTime = OrbitStartTime
        this.OrbitEndTime = OrbitEndTime
        this.position = position
        this.imagePath = imagePath
        this.CZML_Addmoon()
    }

    CZML_Addmoon() {
        this._viewer.scene.moon.show = true
        const sOrbitStartTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(this.OrbitStartTime)
        const sOrbitEndTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(this.OrbitEndTime)
        const HEU_ScenarioTime = sOrbitStartTime + "/" + sOrbitEndTime
        const MoonData = {
            id: this.id,
            availability: HEU_ScenarioTime,
            name: "123",
            description: "MoonbyCZML",

            label: {
                fillColor: {
                    rgba: [0, 255, 0, 255]
                },
                font: "11pt Lucida Console",
                horizontalOrigin: "LEFT",
                pixelOffset: {
                    cartesian2: [10, 0]
                },
                show: true,
                style: "FILL_AND_OUTLINE",
                text: "MoonbyCZML",
                verticalOrigin: "CENTER"
            },

            model: {
                gltf: this.imagePath,
                scale: 1780,
                minimumPixelSize: 10
            },
            position: {
                interpolationAlgorithm: "LAGRANGE",
                interpolationDegree: 5,
                referenceFrame: "INERTIAL",
                epoch: sOrbitStartTime,
                cartesian: this.position
            }
        }
        // 插入该数据对象
        const ret = CZML_GENERALTOOLS_CLASS.InsertModelObjectInformation(this.id, MoonData, true)
        // 上图
        CZML_GENERALTOOLS_CLASS.Upper(this._viewer)
        return ret
    }
}
export default CZML_Moon
